<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
<base href="<%=basePath%>">
<!-- jsp文件头和头部 -->
<%@ include file="../../system/admin/top.jsp"%>
</head>
<body>

	<div class="container-fluid" id="main-container">


		<div id="page-content" class="clearfix">

			<div class="row-fluid">

				<div class="row-fluid">

					<!-- 检索  -->
					<form action="appointment/list.do" method="post" name="Form"
						id="Form">
						<table>
							<tr>

								<td><span class="input-icon"><input value="前一天"  type="button" onclick="yesterday();" />
								</span></td>
								<td>今天：</td>
								<td><span id="sysTime"   onclick="today();"></span></td>
								<td><span class="input-icon"> <input value="后一天"  type="button"  onclick="tomorrow();" />
								</span></td>
								<td><span style="width:18px;height:18px;margin-left:20px;display:block;background-color:#99E5FF;float:left;"></span>&nbsp;<span style="float:left;"> : 可以预约</span>
							    <td><span style="width:18px;height:18px;margin-left:20px;display:block;background-color:#FF9999;float:left;"></span>&nbsp;<span style="float:left;"> : 不可预约</span>
							</tr>
						</table>
						<!-- 检索  -->


						<table id="table_report"
							class="table table-striped table-bordered table-hover">

							<thead>
								<tr>
									<th class="center">会议室名称</th>
									<th class="center">会议室容量</th>
									<th class="center">0</th>
									<th class="center">1</th>
									<th class="center">2</th>
									<th class="center">3</th>
									<th class="center">4</th>
									<th class="center">5</th>
									<th class="center">6</th>
									<th class="center">7</th>
									<th class="center">8</th>
									<th class="center">9</th>
									<th class="center">10</th>
									<th class="center">11</th>
									<th class="center">12</th>
									<th class="center">13</th>
									<th class="center">14</th>
									<th class="center">15</th>
									<th class="center">16</th>
									<th class="center">17</th>
									<th class="center">18</th>
									<th class="center">19</th>
									<th class="center">20</th>
									<th class="center">21</th>
									<th class="center">22</th>
									<th class="center">23</th>
								</tr>
							</thead>

							<tbody>

								<!-- 开始循环 -->
								<c:choose>
									<c:when test="${not empty varList}">
										<c:if test="${QX.cha == 1 }">
											<c:forEach items="${varList}" var="var" varStatus="vs">
												<tr>
													<td>${var.mr_name}</td>
													<td>${var.mr_capacity}</td>
													<c:set var="startTime" value="-1"/>
													<c:set var="end" value="-1"/>
													<c:set var="flag" value="0"/>
													<c:forEach begin="0" end="23" varStatus="vsC">
														<c:if test="${flag==0}">
															<c:choose>
															<c:when test="${not empty meetlist}">
																<c:forEach items="${meetlist}" var="mt" varStatus="vst">
																	<c:if test="${var.mr_id==mt.meetingRoom_id}">
																		<c:if test="${fn:substring(mt.s_time, 11, 13)==vsC.index}">
																			<c:set var="startTime" value="${fn:substring(mt.s_time, 11, 13)}"/>
																			<c:set var="end" value="${fn:substring(mt.e_time, 11, 13)}"/>
																			<c:set var="flag" value="1"/>
																		</c:if>
																	</c:if>
																</c:forEach>
															</c:when>
														</c:choose>
														</c:if>
														<c:if test="${startTime==-1}">
															<td id="${vsC.index}" style="background: #99E5FF"></td>
														</c:if>
														<c:if test="${startTime!=-1 && vsC.index>end}">
															<td id="${vsC.index}" style="background: #99E5FF"></td>
														</c:if>
														<c:if test="${vsC.index>=startTime && vsC.index<end}">
															<td id="${vsC.index}" style="background: #FF9999"></td>
														</c:if>
														<c:if test="${vsC.index==end}">
															<td id="${vsC.index}" style="background: #FF9999"></td>
															<c:set var="flag" value="0"/>
														</c:if>
													</c:forEach>
												</tr>
											</c:forEach>
										</c:if>
										<c:if test="${QX.cha == 0 }">
											<tr>
												<td colspan="100" class="center">您无权查看</td>
											</tr>
										</c:if>
									</c:when>
									<c:otherwise>
										<tr class="main_info">
											<td colspan="100" class="center">没有相关数据</td>
										</tr>
									</c:otherwise>
								</c:choose>


							</tbody>
						</table>


					</form>
				</div>




				<!-- PAGE CONTENT ENDS HERE -->
			</div>
			<!--/row-->

		</div>
		<!--/#page-content-->
	</div>
	<!--/.fluid-container#main-container-->

	<!-- 返回顶部  -->
	<a href="#" id="btn-scroll-up" class="btn btn-small btn-inverse"> <i
		class="icon-double-angle-up icon-only"></i>
	</a>

	<!-- 引入 -->
	<script type="text/javascript">
		window.jQuery
				|| document
						.write("<script src='static/js/jquery-1.9.1.min.js'>\x3C/script>");
	</script>
	<script src="static/js/bootstrap.min.js"></script>
	<script src="static/js/ace-elements.min.js"></script>
	<script src="static/js/ace.min.js"></script>

	<script type="text/javascript" src="static/js/chosen.jquery.min.js"></script>
	<!-- 下拉框 -->
	<script type="text/javascript"
		src="static/js/bootstrap-datepicker.min.js"></script>
	<!-- 日期框 -->
	<script type="text/javascript" src="static/js/bootbox.min.js"></script>
	<!-- 确认窗口 -->
	<!-- 引入 -->
	<script type="text/javascript" src="static/js/jquery.tips.js"></script>
	<!--提示框-->
	<script type="text/javascript">
		$(top.hangge());

		//检索
		function search() {
			top.jzts();
			$("#Form").submit();
		}
	</script>

	<script type="text/javascript">
		$(function() {

			//下拉框
			$(".chzn-select").chosen();
			$(".chzn-select-deselect").chosen({
				allow_single_deselect : true
			});

			//日期框
			$('.date-picker').datepicker();

			//复选框
			$('table th input:checkbox').on(
					'click',
					function() {
						var that = this;
						$(this).closest('table').find(
								'tr > td:first-child input:checkbox').each(
								function() {
									this.checked = that.checked;
									$(this).closest('tr').toggleClass(
											'selected');
								});

					});

		});

		//检索
		function yesterday() {
			top.jzts();
			var dd = new Date();
			dd.setDate(dd.getDate()-1);
			var y = dd.getFullYear();
			var m = dd.getMonth()+1;//获取当前月份的日期
			var d = dd.getDate();
			dd=y+"-"+m+"-"+d;
			location.href='<%=basePath%>appointment/list.do?time='+dd;
		}
		
		function tomorrow() {
			top.jzts();
			var dd = new Date();
			dd.setDate(dd.getDate()+1);
			var y = dd.getFullYear();
			var m = dd.getMonth()+1;//获取当前月份的日期
			var d = dd.getDate();
			dd=y+"-"+m+"-"+d;
			location.href='<%=basePath%>appointment/list.do?time='+dd;
		}
		
		//检索
		function today() {
			top.jzts();
			location.href='<%=basePath%>appointment/list.do';
		}
		

		$(function() {
			var date = new Date();
			var y = date.getFullYear();
			var m = date.getMonth() + 1;
			var d = date.getDate();
			$("#sysTime").html(
					y + "-" + (m > 9 ? m : ("0" + m)) + "-"
							+ (d > 9 ? d : ("0" + d)));
		});
	</script>

</body>
</html>

